home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Snippets / Help Dialog / help.µ.rsrc / help.µ.rsrc.adf / TEXT_130.txt < prev    next >
Text File  |  1996-06-04  |  2KB  |  54 lines

  1. MODIFYING help.c
  2.  
  3. Your final step in adapting Dialog Help to the requirements of your own application is to make some modifications in three areas of the source code file help.c.
  4.  
  5. #defines
  6.  
  7. There is a block of #defines at the top of  help.c which relate to the IDs of the 'TEXT'/'styl' resources, and of the starting (base) IDs of the 'PICT' resources, relevant to the version of Help Dialog you are now viewing:
  8.  
  9.    #define    rTextIntroduction      128
  10.    #define rTextCreatingText      129
  11.    #define rTextModifyHelp        130
  12.    #define rTextAboutCricket      131                    
  13.    #define    rPictIntroductionBase        128
  14.    #define    rPictCreatingTextBase        129
  15.    #define rPictAboutCricketBase        131                    
  16.  
  17. These need to be changed to reflect the requirements of your own version of Help Dialog.
  18.  
  19. Initial 'TEXT'/'styl' ID and Base 'PICT' ID
  20.  
  21. The text and pictures displayed when the dialog opens should be those relating to the first item in the popup menu.  This is achieved by the assignment of values to the global variables  gTextResourceID and gPictResourceBaseID about a third of the way into the function doHelp:
  22.  
  23.    gTextResourceID = rTextIntroduction;
  24.    gPictResourceBaseID = rPictIntroductionBase;
  25.  
  26. Change the assignment to reflect the requirements of your own version of Help Dialog.
  27.  
  28. Response to Popup Menu Choices 
  29.  
  30. Popup menu choices are detected and handled within the ModalDialog loop in the function doHelp.  When the menu item number is retrieved, this switch is entered:
  31.  
  32.    switch(menuItem)
  33.    {
  34.      case 1:
  35.        gTextResourceID     = rTextIntroduction;
  36.        gPictResourceBaseID = rPictIntroductionBase;
  37.        break;
  38.                 
  39.      case 2:
  40.        gTextResourceID     = rTextCreatingText;
  41.        gPictResourceBaseID = rPictCreatingTextBase;
  42.        break;
  43.  
  44.      case 3:
  45.        gTextResourceID     = rTextModifyHelp;
  46.        break;
  47.  
  48.      case 5:
  49.        gTextResourceID     = rTextAboutCricket;
  50.        gPictResourceBaseID    = rPictAboutCricketBase;
  51.        break;
  52.    }
  53.  
  54. Change the number of cases in this switch to reflect the number of menu items in your popup menu.  Also change the assignments so that the global variables   gTextResourceID and gPictResourceBaseID are assigned the correct 'TEXT' IDs and, where appropriate, the correct base 'PICT' ID.